<%= render 'menu/caidauadmin'%>
<p style="color: red"><%= label_tag params[:alert] %></p>
<p style="color: green"><%= label_tag params[:alert1] %></p>
<table>
	<tr>
		<td>
			<fieldset align="left">
			<legend><h2>Search Engine</h2></legend>
			<%= form_tag :action => "searchborrow_process" do%>
	User Name: <%= text_field_tag 'uname'%> <br /> <br />
	Book Name: <%= text_field_tag 'bname'%> <br /> <br />
	<%= submit_tag "Search"%>
<% end %>
		</fieldset>
		<fieldset align="left">
		<legend><h2>New Borrowing</h2></legend>
			<%= form_tag :action => "insertborrow" do%>
			User Name: <%= text_field_tag 'uname'%> <br /> <br />
			Book Name: <%= text_field_tag 'bname'%> <br /> <br />
			<%= submit_tag "Insert"%> 
<% end %>
		</fieldset>
</td>
		<td valign="top">
			

<% if @result!=nil %>
	<table class="vienxanh">
  <tr>
	<td>Name</td>
	<td>Book</td>
	<td>Borrow date</td>
	<td>Deadline</td>
	
	<td>Action</td>

	
  </tr>

<% @result.each do |r| %>
  <tr>
  	<% @user=User.find_by_id(r.Uid) %>
  	<% @book=Book.find_by_id(r.Bid) %>
    <td><%= @user.Name %></td>
    <td><%= @book.Name %></td>
    
    <td><%= r.Borrow_date.strftime("%d-%m-%Y") %></td>
    <td><%= r.Deadline.strftime("%d-%m-%Y") %></td>
 
 	<% if(r.Status=="Order")%>
 	<td><%= link_to "Muon sach", {:action => "muonsach", :boid => r.id } %></td>
 	<% else%>
 	<td><%= link_to "Tra sach", {:action => "trasach", :boid => r.id} %></td>
 	<% end%>
  </tr>

<% end %>

</table>
<% end %>
			
		</td>
	</tr>
	
	
</table>


